package se.webbzon.boltzmann.minigame.question;

import se.webbzon.boltzmann.minigame.page.PageItem;
import se.webbzon.boltzmann.minigame.page.PageLayout;
import se.webbzon.boltzmann.minigame.page.Tag;

public class AlternativeTag implements Tag {

	@Override public String getName() {
		return "li";
	}

	@Override public PageItem createItem(PageLayout layout, String content) {
		String[] answer = content.split(":");
		if (answer.length == 1)
			return new AlternativeItem(layout, 0, answer[0]);
		else {
			final int alt = Integer.parseInt(answer[0]);
			return new AlternativeItem(layout, alt, answer[1]);
		}
	}

}
